<template>
	<view>
		<view class="" v-if="istz">
			<view class="mainpadding flexleft" style="background-color: #fea23d;align-items: flex-start;">
				<image :src="tzinfo.userInfo.avatar ? tzinfo.userInfo.avatar : emptyAvatar" class="headimg margin_right3" mode=""></image>
				<view class="">
					<view class="xiaobai smalltext margin_top1">{{tzinfo.userInfo.nickname}}</view>
					<view class="xiaobai smalltext margin_top1">{{$t('tuanzhang.tjr')}}：{{tzinfo.userSpreader}}</view>
					<text class="huiyuan xiaobai smalltext margin_top1">{{$t('tuanzhang.cjhy')}}</text>
				</view>
			</view>
			<view class="mainpadding_top ffffff xiahuaxian">
				<view class="xiaohuang sanshier bold">{{tzinfo.successWithdrawal}}</view>
				<view class="ershiba margin_top xiaohei">{{$t('tuanzhang.cgtxsy')}}</view>
			</view>
			<view class="mainpadding ffffff xiahuaxian">
				<view class="xiaohuang sanshier bold">{{tzinfo.canWithdrawal}}</view>
				<view class="flexbetween margin_top">
					<view class="ershiba  xiaohei">{{$t('tuanzhang.cgtxsy')}}</view>
					<view class="tixian xiaobai smalltext" @click="show=true">{{$t('tuanzhang.sytx')}}</view>
				</view>
			</view>
			<view class="mainpadding_top ffffff">
				<view class="flexbetween flex_wrap">
					<view class="flexleft margin_top" style="width: 50%;" @click="jumpurl('/pages/tuanzhang/shouyi')">
						<image src="../../static/image/system/qd.png" class="leftclassimg" mode=""></image>
						<view class="">
							<view class="ershiba">{{$t('tuanzhang.sy')}}</view>
							<view class="ershil">{{tzinfo.income}}{{$t('tuanzhang.y')}}</view>
						</view>
					</view>
					<view class="flexleft margin_top" style="width: 50%;" @click="jumpurl('/pages/tuanzhang/dingdanmx')">
						<image src="../../static/image/system/dd.png" class="leftclassimg" mode=""></image>
						<view class="">
							<view class="ershiba">{{$t('tuanzhang.ddmx')}}</view>
							<view class="ershil">{{tzinfo.orderList}}{{$t('tuanzhang.b')}}</view>
						</view>
					</view>
					<view class="flexleft margin_top5" style="width: 50%;" @click="jumpurl('/pages/tuanzhang/shouyimx')">
						<image src="../../static/image/system/symx.png" class="leftclassimg" mode=""></image>
						<view class="">
							<view class="ershiba">{{$t('tuanzhang.symx')}}</view>
							<view class="ershil">{{tzinfo.revenueDetails}}{{$t('tuanzhang.y')}}</view>
						</view>
					</view>
					<view class="flexleft margin_top5" style="width: 50%;" @click="jumpurl('/pages/tuanzhang/wodetd')">
						<image src="../../static/image/system/td.png" class="leftclassimg" mode=""></image>
						<view class="">
							<view class="ershiba">{{$t('tuanzhang.wdtd')}}</view>
							<view class="ershil">{{tzinfo.teamList}}</view>
						</view>
					</view>
				</view>
			</view>
			<view class="mainpadding_top flexbetween ffffff">
				<view class="flexleft">
					<image src="@/static/image/system/dpp.png" class="margin_right3" mode=""
						style="width: 40rpx;height: 40rpx;"></image>
					<view class="sanshier xiaohei bold">{{$t('tuanzhang.yqhy')}}</view>
				</view>
				<u-icon name="arrow-right" color="#999" size="20"></u-icon>
			</view>
			<view class="ffffff mainpadding_top">
				<view class="banner sanshier xiaohei bold textcenter">-{{$t('tuanzhang.djzk')}}-</view>
				<view class="flexbetween flex_wrap ">
					<view class="spbox margin_top" v-for="item in list"
						@click="jumpdetail('/pages/index/shangpinxq?id=',item.id)">
						<image class="sptp" :src="item.picUrl" mode=""></image>
						<view class="" style="padding: 30rpx 15rpx;">
							<view class="ershiba xiaohei xiankuan textcenter">{{item.name}}</view>
							<view class="strongtext xiaojin textcenter margin_top">￥{{item.counterPrice}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="" v-if="!istz">
			<image src="../../static/image/system/topImg.jpg" mode="widthFix" style="width: 100%;"></image>
			<view class="mainpadding_top ffffff">
				<view class="flexleft">
					<image src="../../static/image/system/yqtx.png" style="width: 40rpx;height: 40rpx;" class="margin_right3" mode=""></image>
					<view class="sanshier xiaohei bold">{{$t('tuanzhang.yqtx')}}</view>
				</view>
				<view class="margin_top flexleft" @click="jumpdetail('/pages/index/shangpinxq?id=',goodsinfo.id)">
					<image :src="goodsinfo.images" style="width: 120rpx;height: 120rpx;" mode="" class="margin_right3"></image>
					<view class="flexcolumbet" style="height: 110rpx;align-items:flex-start;">
						<view class="xiaohei ershiba yhxk" style="width: 500rpx;">{{goodsinfo.goodsName}}</view>
						<view class="xiaohei ershiba yhxk">￥{{goodsinfo.price}}</view>
					</view>
				</view>
				<view class="xiaohei ershiba margin_top">{{$t('tuanzhang.gm1')}}<text class="xiaohong">{{$t('tuanzhang.gm2')}}</text>{{$t('tuanzhang.gm3')}}</view>
				<view class="bighbtn margin_top" @click="jumpdetail('/pages/index/shangpinxq?id=',goodsinfo.goodsId)">{{$t('tuanzhang.gm4')}}</view>
			</view>
		</view>
		<!-- 提现弹框 -->
		<u-modal :show="show" :title="$t('tuanzhang.tx')" :confirmText="$t('tuanzhang.qr')" @confirm="chongzhi" :cancelText="$t('tuanzhang.qx')" @cancel="show=false"
			showCancelButton>
			<view class="slot-content mainpadding" style="width: 600rpx;">
				<view class="flexbetween  margin_top">
					<view class="main_size bold hei_text">{{$t('tuanzhang.txje')}}：</view>
					<input type="number" class="textright" :placeholder="$t('tuanzhang.qsrtxje')" v-model="price">
				</view>
				<view class="margin_top">
					<view class=" xiaohong smalltext">1.{{dataAll.notice}}</view>
					<view class=" xiaohong smalltext margin_top1">2.{{$t("tuanzhang.tsnr")}}</view>
				</view>
			</view>
		</u-modal>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				istz:false,
				show:false,
				list: [],
				goodsinfo:{},
				tzinfo:{},
				price:"",
				dataAll:{}
			}
		},
		onLoad() {
			this.getgoods()
		},
		onShow() {
			this.init()
		},
		methods: {
			getinfo(){
				httpRequest.request('/wx/spreader/spreaderRevenueDetails', 'GET', {
				}).then(res => {
					this.dataAll = res.data
				})
			},
			init() {
				httpRequest.request('/wx/spreader/getIsSpeader', 'GET', {
				}).then(res => {
					if(res.data==1){
						this.istz = true
						this.gettzinfo()
						this.getinfo()
					}else{
						this.istz = false
						this.goodsinfo = res.data.goods
						let that = this
						uni.setNavigationBarTitle({
							title:that.$t("tuanzhang.sqtz")
						})
					}
					
				})
			},
			// 提现
			chongzhi(){
				if(this.price==""){
					httpRequest.toast(this.$t("tuanzhang.qsrje"))
					return false
				}
				httpRequest.request('/wx/spreader/spreaderMoney', 'GET', {
					money:this.price
				}).then(res => {
					this.show = false
					this.price = ""
					httpRequest.toast(res.errmsg)
				})
			},
			gettzinfo(){
				
				httpRequest.request('/wx/spreader/index', 'GET', {
				}).then(res => {
					this.tzinfo = res.data
				})
			},
			getgoods(){
				httpRequest.request('/wx/goods/related', 'GET', {
					id: 1181287
				}).then(res => {
					this.list = res.data.goodsList
				})
			}
		}
	}
</script>

<style>
	.headimg {
		width: 140rpx;
		height: 140rpx;
		border-radius: 50%;
	}

	.huiyuan {
		border: 1rpx #fff solid;
		border-radius: 50rpx;
		display: inline-block;

		padding: 5rpx 20rpx;
	}

	.tixian {
		border-radius: 50rpx;
		padding: 5rpx 20rpx;
		background-color: #fea23d;
	}

	.leftclassimg {
		width: 80rpx;
		height: 80rpx;
		margin-right: 30rpx;
	}
</style>